<div id="wrapFooter">
			<div id="innerFooter">
			
				<div id="leftFooter">
					<div class="wrapBottomNav">
						<p class="bottomNavTitle">PUN.VN</p>
						<ul class="bottomNav">
							<li><a href="">Giới thiệu</a></li>
							<li><a href="">Liên hệ</a></li>
							<li><a href="">Điều lệ</a></li>
							<li><a href="">FAQS</a></li>
						</ul>
					</div><!-- end .wrapBottomNav -->
					
					<div class="wrapBottomNav">
						<p class="bottomNavTitle">Hướng dẫn Sử Dụng Pun.vn</p>
						<ul class="bottomNav">
							<li><a href="">Đăng nhập Facebook</a></li>
							<li><a href="">Upload Hình</a></li>
							<li><a href="">Upload Video</a></li>
							<li><a href="">Upload Text</a></li>
						</ul>
					</div><!-- end .wrapBottomNav -->
				
				</div><!-- end #leftFooter -->
				
				<div id="rightFooter">
					
					
					<div id="wrapCopyright">
						<div id="footerLogo">
							<a href=""><img src="public/images/footerLogo.png" alt="MyDomain.com" /></a>
						</div>
						
						<div id="copyright">
							Copyright &copy; 2013-2016 PUN.VN . All rights reserved
						</div>
						
					</div><!-- end #wrapCopyright -->
				</div>
				
				<div class="clr"></div>
			</div><!-- end #innerFooter -->
		</div><!-- end #wrapFooter -->
		
	</div><!-- end #wrapAll -->
	
	<div id="errorElementReveal" class="reveal-modal error-reveal-modal" style="display: none;">
		<div class="client-error">
			<div class="text-error">
				<h2>Lỗi</h2>
				<span>Không thể tải nội dung của bài viết. Xin vui lòng refresh trang và thử lại.</span>
			</div>
			
		</div>
	</div>
	<div id="toTop"></div>
	
	<script type="text/javascript">
	
		$(document).ready(function(){
			$('.video_play_icon').center();
			
			$('#relatedPosts').gridalicious({
				gutter: 5,
				width: 100,
				animate: true,
			  	animationOptions: {
				    queue: true,
				    speed: 100,
				    duration: 300,
				    effect: 'fadeInOnAppear',
			  	}	
			});
			/*
			 * Show quick view of a thread
			 */
			 $('.itemImage').live('click', function(){
				
				blankId = $(this).parent().parent().attr('data-href');
				postType = $(this).parent().parent().attr('data-rel');
				
				if(!blankId){
					return;
				}
				
				popupControl = getPopupControl(blankId, postType);
				modalBox(blankId, postType, popupControl);
				
			});


			$('.controlNavItem').live('click', function(e){
				
				e.preventDefault();
				$('#infscr-loading').remove();
				$('.popupControl').hide(); 
				$('.modal').modal('hide');
				navigation = $(this).attr('id');
				id = $(this).parent().parent().attr('data-href');
				postType = $(this).parent().parent().attr('data-rel');

				if(navigation == 'nextNav'){
					nextItemId = $('#innerItem-'+id+'-'+postType).parent().next().find('.innerItem').attr('data-href');
					nextItemType = $('#innerItem-'+id+'-'+postType).parent().next().find('.innerItem').attr('data-rel');
				}else{
					nextItemId = $('#innerItem-'+id+'-'+postType).parent().prev().find('.innerItem').attr('data-href');
					nextItemType = $('#innerItem-'+id+'-'+postType).parent().prev().find('.innerItem').attr('data-rel');
				}
				

				if(!nextItemId){
					alert('Hết dữ liệu trong trang. Load thêm để xem nhé!');
					return;
				}

				popupControl = getPopupControl(nextItemId, nextItemType);
				
				modalBox(nextItemId, nextItemType, popupControl);
			
			});
		
			
			//$("#wrapHeader").sticky({topSpacing:0});
			//$("#sectionControl").sticky({topSpacing:0});
			
			
			$.scrollUp({
			    scrollName: 'toTop', // Element ID
			    scrollDistance: 1, // Distance from top before showing element (px)
			    topSpeed: 100, // Speed back to top (ms)
			    animation: 'fade', // Fade, slide, none
			    animationInSpeed: 200, // Animation in speed (ms)
			    animationOutSpeed: 200, // Animation out speed (ms)
			    scrollText: '<img src="public/images/top.png" alt="To top" />', // Text for element
			    activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF'
			  });

			


			function modalBox(id, postType, popupControl){

				if(!$('#popupElem-innerItem-' + id + '-' + postType).text().length){
					$('#innerItem-'+id+'-'+postType).append('<div role="dialog" id="popupElem-innerItem-' + id + '-' + postType + '" class="modal" style="display: none;">');
					$('#popupElem-innerItem-' + id + '-' + postType).append('<div class="modal-dialog modal-wide" id="content-innerItem-'+ id +'">');
					$('#popupElem-innerItem-' + id + '-' + postType).append('</div><!-- end .modal-dialog --></div><!-- end .modal .fade -->');
					$('#popupElem-innerItem-'+id+'-'+postType+ ' > div.modal-dialog').append('<div id="loadMoreItems" class="normalLoadBtn" style="margin-top:20px;"><img  width="20" src="public/images/loading.gif" alt="loading" /> Loading </div><!-- end #loadMoreItems -->');
					$('#popupElem-innerItem-' + id + '-' + postType).modal();
					ajaxCallRequest(id, postType, popupControl);
				}else{
					$('#popupElem-innerItem-' + id + '-' + postType).modal();
					$('#popupControl-innerItem-'+id+'-'+postType).show();
					//FB.XFBML.parse(document.getElementById('popupControl-innerItem-'+ id+'-'+postType));
				}
			}

			function ajaxCallRequest(id, postType, popupControl){
			
				$.ajax({
					url : '<?= BASE_URL ?>index.php?module=ajax&act=ajax&ajaxGetNews=1',
					type : 'POST',
					data : {id: id, postType: postType},
					
					success: function(data){
						
						$('#popupElem-innerItem-' + id + '-' + postType +' > div.modal-dialog > div#loadMoreItems').remove();
						newData = $.parseJSON(data);
						
						if(newData.data){
							
							$('#popupElem-innerItem-' + id + '-' + postType + ' > #content-innerItem-' + id).append(newData.data);
							$('#wrapAll').append(popupControl);
							$('#popupControl-innerItem-' + id).sticky();
							FB.XFBML.parse(document.getElementById('popupControl-innerItem-'+ id+'-'+postType));
							FB.XFBML.parse(document.getElementById('popupElem-innerItem-' + id + '-' + postType));
						}
					},
				});
			}

			function getPopupControl(id, postType){
				
				popupControl = '<div class="popupControl" id="popupControl-innerItem-'+id+'-'+postType+'" data-href="'+id+'" data-rel="'+postType+'">';
				popupControl += '<div class="wrap-fb-like-popup"><div class="likePopupLabel">Thích bài này?</div><div class="fb-like fb-like-popup" data-href="'+baseUrl+'index.php?module=news&act=view&id='+id+'" data-width="200" data-layout="button_count" data-show-faces="false" data-send="false"></div>';
				popupControl += '<div class="clr"></div></div>';
				
				popupControl += '<div class="controlNav">';
				
				popupControl += '<a class="controlNavItem" id="preNav" href="">&nbsp;</a>';
				popupControl += '<a class="controlNavItem" id="nextNav" href="">&nbsp;</a>';
				popupControl += '</div>';
				popupControl += '<div><p class="report_post" style="float: right; padding: 5px; margin-right: 10px; margin-top:6px;" data-href="'+id+'" style="padding: 10px;"><a href="#"><i class="font12 blue icon-warning" style="color: #cc0000;"> Báo bài xấu!</i></a></p>';
				popupControl += '</div><!-- end .popupControl -->';
				return popupControl;
			}
			
		});


	    $('.modal').live('hide.bs.modal', function () {
		    if(!$(this).attr('data-href')){
				    
				$('.popupControl').hide(); 
				var id = $(this).attr('id');
	
				iframe = $('#'+id).find('iframe.embed_video')
				src = iframe.attr('src');
				iframe.attr('src', '');
				iframe.attr('src', src);
		    }
		});

		/*
		 *  Report post
		 */
		 $('.report_post').live('click',function(e){
				e.preventDefault();
				dataHref = $(this).parent().parent().attr('data-href');
				dataRel = $(this).parent().parent().attr('data-rel');
				if(!$('#modal_report_' + dataHref).length){
					
					$.ajax({

						url: '<?= BASE_URL ?>index.php?module=ajax&act=ajax&get_modal_report=1',
						type: 'POST',
						data: {post_id : dataHref, rel: dataRel,},
						success: function(data){
							$('body').append(data);
							$('#modal_report_' + dataHref).modal();
							//$('#modal_report').show();
						}
					});
					
				}else{
					$('#modal_report_' + dataHref).modal();
				}
			});

			$('.submit_report').live('click', function(e){
				e.preventDefault();
				modalContent = $(this).attr('data-href');
				modalRel = $(this).attr('data-rel');
				$(".alert").remove();
					$.ajax({
						url: '<?= BASE_URL ?>index.php?module=ajax&act=ajax&send_report=1',
						type: 'POST',
						data: { 
							txt_report_content: $('#txt_report_content_' + $(this).attr('data-href')).val(),
							post_id: $(this).attr('data-href'),
							rel: $(this).attr('data-rel')
						},
						success: function(data){
							if(data) newData = JSON.parse(data);
							if(newData.errors){
			    				$.each(newData.errors, function(e, error){
				    				console.log(e);
				    				console.log(error);
				    				if(e != 'error'){
				    					$('#' + e).parent().append('<div id="'+e+'_error" class="alert alert-danger alert-dismissable" style="display: none;"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+error+'</div>');
				    					$('#' + e + '_error').slideDown('fast');
				    				}
			    				});
							}else if(newData.message){
								
								//console.log($('#txt_report_content_' + $(this).attr('data-href')).val());
								$('#modal-content-' + modalContent).append('<div id="report_success_'+modalContent+'" class="alert alert-success alert-dismissable" style="display:none;">Cám ơn bạn đã báo cáo nội dung xấu. Chúng tôi sẽ kiểm tra bài viết trong thời gian sớm nhất.</div>');
								//$('#report_success').slideDown('fast');
								var test = $('#report_success_' + modalContent).slideDown('fast').delay(1000).slideUp('fast', function(){$('#modal_report_' + modalContent).modal('hide');});
								$('#txt_report_content_' + modalContent).val('');
								
							}
						}
					});
				});
			
		
	</script>
			
	<script type="text/javascript" language="javascript" src="public/exts/js/bootstrap.min.js"></script>
	<script type="text/javascript" language="javascript" src="public/exts/js/jquery.grid-a-licious.min.js"></script>
	<script type="text/javascript" language="javascript" src="public/exts/js/jquery.sticky.js"></script>
	<script type="text/javascript" language="javascript" src="public/exts/js/jquery.scrollUp.js"></script>
	<script type="text/javascript" language="javascript" src="public/exts/js/select2.min.js"></script>
	<script type="text/javascript" language="javascript" src="public/exts/js/jquery.center.js"></script>
	<script type="text/javascript" language="javascript" src="public/exts/js/tinymce/tinymce.min.js"></script>
	
</body>
	
	
</html>